Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validateToken method to auth client #10

Merged
merged 1 commit into from
Apr 10, 2024
Merged

Add validateToken method to auth client #10

merged 1 commit into from
Apr 10, 2024

Conversation

MrCreosote
Copy link
Member

No description provided.

@MrCreosote MrCreosote requested review from briehl and Xiangs18 April 8, 2024 22:53
Copy link

codecov bot commented Apr 8, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 95.58%. Comparing base (30356b7) to head (d48bd24).
Report is 4 commits behind head on main.

Files Patch % Lines
src/main/java/us/kbase/auth/client/AuthClient.java 88.88% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main      #10      +/-   ##
============================================
- Coverage     96.25%   95.58%   -0.67%     
- Complexity       71       77       +6     
============================================
  Files             5        5              
  Lines           187      204      +17     
  Branches         37       39       +2     
============================================
+ Hits            180      195      +15     
- Misses            5        7       +2     
  Partials          2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@briehl briehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me, as long as those test tokens are immortal.

KBASE_CI_TOKEN2: ${{ secrets.KBASE_CI_TOKEN2 }}
run: |
cp test.cfg.example test.cfg
sed -i "s#^auth_token1 =.*#auth_token1 = $KBASE_CI_TOKEN#" test.cfg
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You test stuff live? Do these tokens expire? You might want to make a calendar event to update once in a while.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're managed by devops and last for 100 years

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point I want to stand up the auth server in testmode rather than use tokens, but... later

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how the old tests ran so I didn't want to change too much

sed -i "s#^auth_token1 =.*#auth_token1 = $KBASE_CI_TOKEN#" test.cfg
sed -i "s#^auth_token2 =.*#auth_token2 = $KBASE_CI_TOKEN2#" test.cfg
sed -i "s#^auth_user1 =.*#auth_user1 = kbase_bot#" test.cfg
sed -i "s#^auth_user2 =.*#auth_user2 = sychan168#" test.cfg
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...and maybe make a new user here... :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah. :/ I mentioned it to devops

if (t != null) {
return t;
}
final URI target = rootURI.resolve("api/V2/token");
Copy link

@Xiangs18 Xiangs18 Apr 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to setRequestMethod here when calling target url?
api/v2/token could be either a GET or POST based on auth2 doc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a GET by default and the method we want to use for both tokens, and later users, are GETs

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link

@Xiangs18 Xiangs18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@MrCreosote MrCreosote merged commit 2f6cedf into main Apr 10, 2024
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants